﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

namespace 类的继承与多态
{
   abstract class product
    {
        protected decimal price;
       protected string name;

        public Decimal Price { get { return price; } set { price = value; } }
        public  string Name { get { return name; } set { name = value; } }
        //this 表示调用带参的构造函数
        public product():this("")
        {
            Debug.WriteLine("调用Product无参构造函数");
        }
        public product(string name)
        {
            this.name = name;
            Debug.WriteLine("调用Product带参构造函数");
        }
        ~product()
        {
            Debug.WriteLine("调用product析构函数");
        }
        //显示基本信息
        public virtual void show()
        {
            Console.WriteLine("价格{0}",price);
            Console.WriteLine("名字{0}",name);

        }
        //显示详细信息
        public abstract void showdetil();
        
    }
}
